export default function formatDate(date) {
  var date = new Date(parseInt(date) * 1000);
  var Y = date.getFullYear() + '-';
  var M = date.getMonth();
  var D = date.getDate();
  // var h = date.getHours() + ':';
  // var m = date.getMinutes() + ':';
  // var s = date.getSeconds(); 
  switch (M) {
    case 0:
      M = '01' + '-';
      break;
    case 1:
      M = '02' + '-';
      break;
    case 2:
      M = '03' + '-';
      break;
    case 3:
      M = '04' + '-';
      break;
    case 4:
      M = '05' + '-';
      break;
    case 5:
      M = '06' + '-';
      break;
    case 6:
      M = '07' + '-';
      break;
    case 7:
      M = '08' + '-';
      break;
    case 8:
      M = '09' + '-';
      break;
    case 9:
      M = '10' + '-';
      break;
    case 10:
      M = '11' + '-';
      break;
    case 11:
      M = '12' + '-';
      break;
  }
  
  switch (D) {
    case 1:
      D = '01';
      break;
    case 2:
      D = '02';
      break;
    case 3:
      D = '03';
      break;
    case 4:
      D = '04';
      break;
    case 5:
      D = '05';
      break;
    case 6:
      D = '06';
      break;
    case 7:
      D = '07';
      break;
    case 8:
      D = '08';
      break;
    case 9:
      D = '09';
      break;
    case 10:
      D = '10';
      break;
    case 11:
      D = '11';
      break;
    case 12:
      D = '12';
      break;
  }
  
  return Y + M + D;
}